home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / misc1 / iv26_w30.zip / INTERVIE / RUBLINE.H < prev    next >
C/C++ Source or Header  |  1980-01-03  |  3KB  |  104 lines

  1. /*
  2.  * Copyright (c) 1987, 1988, 1989 Stanford University
  3.  *
  4.  * Permission to use, copy, modify, distribute, and sell this software and its
  5.  * documentation for any purpose is hereby granted without fee, provided
  6.  * that the above copyright notice appear in all copies and that both that
  7.  * copyright notice and this permission notice appear in supporting
  8.  * documentation, and that the name of Stanford not be used in advertising or
  9.  * publicity pertaining to distribution of the software without specific,
  10.  * written prior permission.  Stanford makes no representations about
  11.  * the suitability of this software for any purpose.  It is provided "as is"
  12.  * without express or implied warranty.
  13.  *
  14.  * STANFORD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  15.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS.
  16.  * IN NO EVENT SHALL STANFORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  17.  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  18.  * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  19.  * OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  20.  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21.  */
  22.  
  23. /*
  24.  * Rubberbanding for simple lines.
  25.  */
  26.  
  27. #ifndef rubline_h
  28. #define rubline_h
  29.  
  30. #include <InterViews/rubband.h>
  31.  
  32. class RubberLine : public Rubberband {
  33. public:
  34.     RubberLine(
  35.         Painter*, Canvas*, Coord x0, Coord y0, Coord x1, Coord y1,
  36.     Coord offx = 0, Coord offy = 0
  37.     );
  38.  
  39.     virtual void GetOriginal(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  40.     virtual void GetCurrent(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  41.     virtual void Draw();
  42. protected:
  43.     Coord fixedx, fixedy;
  44.     Coord movingx, movingy;
  45. };
  46.  
  47. class RubberAxis : public RubberLine {
  48. public:
  49.     RubberAxis(
  50.         Painter*, Canvas*, Coord x0, Coord y0, Coord x1, Coord y1,
  51.     Coord offx = 0, Coord offy = 0
  52.     );
  53.  
  54.     virtual void GetCurrent(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  55. };
  56.  
  57. class SlidingLine : public RubberLine {
  58. public:
  59.     SlidingLine(
  60.     Painter*, Canvas*, Coord x0, Coord y0, Coord x1, Coord y1,
  61.     Coord rfx, Coord rfy, Coord offx = 0, Coord offy = 0
  62.     );
  63.  
  64.     virtual void GetCurrent(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  65. protected:
  66.     Coord refx;
  67.     Coord refy;
  68. };
  69.  
  70. class ScalingLine : public RubberLine {
  71. public:
  72.     ScalingLine(
  73.         Painter*, Canvas*, Coord x0, Coord y0, Coord x1, Coord y1,
  74.     Coord cx, Coord cy, Coord offx = 0, Coord offy = 0
  75.     );
  76.     virtual void GetCurrent(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  77.     float CurrentScaling();
  78. protected:
  79.     Coord centerx, centery;
  80.     int width, height;
  81. };
  82.  
  83. class RotatingLine : public RubberLine {
  84. public:
  85.     RotatingLine(
  86.     Painter*, Canvas*, Coord x0, Coord y0, Coord x1, Coord y1, 
  87.     Coord cx, Coord cy, Coord rfx, Coord rfy, 
  88.     Coord offx = 0, Coord offy = 0
  89.     );
  90.  
  91.     virtual void GetCurrent(Coord& x0, Coord& y0, Coord& x1, Coord& y1);
  92.     float OriginalAngle();
  93.     float CurrentAngle();
  94. protected:
  95.     void Transform (
  96.     Coord& x, Coord& y,
  97.     double a0, double a1, double b0, double b1, double c0, double c1
  98.     );
  99. protected:
  100.     Coord centerx, centery, refx, refy;
  101. };
  102.  
  103. #endif
  104.